package org.wzq.spring_aop;

import org.springframework.aop.AfterReturningAdvice;

import java.lang.reflect.Method;

/**
 * Created by wzq on 14-11-18.
 */
public class LogAfterAdvice implements AfterReturningAdvice {
    @Override
    public void afterReturning(Object retValue, Method targetMethod, Object[] args, Object targetClass) throws Throwable {
        boolean isSucc = (Boolean) retValue;
        if (isSucc) {
            String className = targetClass.getClass().getName();
            String methodName = targetMethod.getName();
            String info = "logAfter," + className + "." + methodName + "() be called";
            System.out.println(info);
        }
    }
}
